﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FrontEnd
{
    /// <summary>
    /// A signal that indicates the end of data.
    /// </summary>
    public class DataEndSignal : Signal
    {
        private long duration;


        /**
        /// Constructs a DataEndSignal.
         *
        /// @param duration the duration of the entire data stream in milliseconds
         */
        public DataEndSignal(long duration) 
            :this(duration, DateTime.Now.Ticks)
        {
            
        }


        /**
        /// Constructs a DataEndSignal with the given creation time.
         *
        /// @param duration the duration of the entire data stream in milliseconds
        /// @param time     the creation time of the DataEndSignal
         */
        public DataEndSignal(long duration, long time) 
            :base(time)
        {
            
            this.duration = duration;
        }


        /**
        /// Returns the duration of the entire data stream in milliseconds
         *
        /// @return the duration of the entire data stream in milliseconds
         */
        public long getDuration() {
            return duration;
        }


        /**
        /// Returns the string "DataEndSignal".
         *
        /// @return the string "DataEndSignal"
         */
        override
        public String ToString() 
        {
            return ("DataEndSignal: creation time: " + getTime() + ", duration: " +
                    getDuration() + "ms");
        }
    }
}
